/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: op task.
 * Author: liutianming
 * Create: 2022-11-28
 */

#ifndef HDDS_PARAM_H
#define HDDS_PARAM_H

#include <vector>
#include <queue>
#include "driver/ascend_hal.h"
#include "hccl_types.h"
#include "base.h"

namespace hccl {

constexpr unsigned int EMBEBDING_GROUP_ID = 20;

enum class EmbeddingType {
    LOOK_UP,
    UPDATE
};

struct WorkSpace {
    void *sendWorkSpace = nullptr;
    void *recvWorkSpace = nullptr;
};

struct EmbeddingData {
    u64 keyMaxNum;
    s64 *keys;
    void *value;
    u64  valueItemSize;
    WorkSpace workSpace;
    s32 tableId;
    s32 insertFlag;
    std::map<u32, u32> psMap; // {psId, rankId}
    std::map<u32, u64> waitLookUpRanks;
    u32 devId;
};

struct PsEnvelopeInfo {
    u32 envelopeSize;
    std::vector<std::queue<void *>> envelopeList;  // 以rankId为下标的信封队列
};

struct EventInfo {
    u32 devId;
    u32 threadId;
    unsigned long long eventBitmap;
};

struct DeviceCommInitInfo {
    const char* rankTableM;
    uint32_t rank;
    const CommAttr* attr;
};

}
#endif
